/*
 * Copyright 2009 Biz-e (info@biz-e.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.biz_e.gwt.baselib.ui.client.menu;

import com.google.gwt.user.client.ui.Widget;

/**
 * An IMenuItem implementation can be shown using the {@link MenuPanel}
 * 
 * @author Joost A. Bloemsma
 */
public interface IMenuItem {

    /**
     * Adds a {@link MenuItemClickedListener}
     * 
     * @param listener
     */
    public void addListener(MenuItemClickedListener listener);

    /**
     * Returns the {@link Widget} to be shown in the menu
     * 
     * @return the {@link Widget}
     */
    public Widget getWidget();

    /**
     * @return the text
     */
    public String getText();

    /**
     * @return the allwaysVisible
     */
    public boolean isAlwaysVisible();

    /**
     * @return the selected
     */
    public boolean isSelected();

    /**
     * @param selected
     *            the selected to set
     */
    public void setSelected(boolean selected);

    /**
     * @return the manager
     */
    public IMenuPanelManager getManager();

    /**
     * @param manager
     *            the manager to set
     */
    public void setManager(IMenuPanelManager manager);

    /**
     * 
     * @author Joost A. Bloemsma
     */
    public interface MenuItemClickedListener {
        /**
         * I fires when the widget is clicked.
         * 
         * @param item
         *            a reference to the {@link IMenuItem} implementation
         */
        public void menuItemClicked(IMenuItem item);
    }
}
